package com.aaa.service;

import com.aaa.dao.MyLoanDao;
import com.aaa.pojo.MyLoan;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MyLoanService {
    @Autowired
    private MyLoanDao myLoanDao;
    //添加
    public void insert(MyLoan myLoan){
        myLoanDao.insert(myLoan);
    }
    public List<MyLoan> selectByUid(Integer uid){
        return myLoanDao.selectByUid(uid);
    }
    public PageInfo<MyLoan> getLoanByPage(int uid,int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);//这行是重点，表示从pageNum页开始，每页pageSize条数据
        List<MyLoan> list = myLoanDao.selectByUid(uid);
        PageInfo<MyLoan> pageInfo = new PageInfo<MyLoan>(list);
        return pageInfo;
    }
    public void updateMyLoan(String ml_id){
        myLoanDao.updateMyLoan(ml_id);
    }
}
